This tutorial uses R version 4.0.0, RRPP version 0.5.2, tidyverse version 1.3.0, and kableExtra version 1.1.0.

  1. load necessary packages
library(RRPP)
library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.2.1     ✓ purrr   0.3.3
## ✓ tibble  2.1.3     ✓ dplyr   0.8.4
## ✓ tidyr   1.0.2     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.4.0
## ── Conflicts ───────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(kableExtra)
## 
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
## 
##     group_rows
  1. Upload data
path <- "~/Box/Summer 2018 TX Endo Field Samples and Analysis/Statistics/Old + Young Chlorophyll/"

chldata <- read.csv(paste(path, "chlorophyll_data.csv", sep=""), header = T, row.names = 1)

# create a total chlorophyll column (a + b)
chldata$Total <- chldata$Chl.a + chldata$Chl.b
  1. Calculate total chlorophyll content, summary statistics, and visualize data.
# plot chl a
chla <- chldata %>% ggplot(aes(x=Fungus, y=Chl.a, fill=Water)) +  geom_boxplot() + theme_classic() + facet_wrap(~Age,dir="v")
print(chla + labs(title="Chlorophyll a Content in Leaves"))

# plot chl b
chlb <- chldata %>% ggplot(aes(x=Fungus, y=Chl.b, fill=Water)) + geom_boxplot() +  theme_classic() + facet_wrap(~Age,dir="v")
print(chlb + labs(title="Chlorophyll b Content in Leaves"))

# plot total chlorophyll
tot <- chldata %>% ggplot(aes(x=Fungus, y=Total, fill=Water)) + geom_boxplot() + theme_classic() + facet_wrap(~Age,dir="v")
print(tot + labs(title="Total Chlorophyll Content in Leaves"))

# plot chl b/a ratio
chlb.a <- chldata %>% ggplot(aes(x=Fungus, y=Chl.b.a.ratio, fill=Water)) +  geom_boxplot() + theme_classic() + facet_wrap(~Age,dir="v")
print(chlb.a + labs(title="Chlorophyll b/a Ratio"))

# summary statistics
stats <- chldata %>% group_by(Water, Fungus) %>% select(Chl.a) %>% summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))
## Adding missing grouping variables: `Water`, `Fungus`
## Warning: funs() is soft deprecated as of dplyr 0.8.0
## Please use a list of either functions or lambdas: 
## 
##   # Simple named list: 
##   list(mean = mean, median = median)
## 
##   # Auto named with `tibble::lst()`: 
##   tibble::lst(mean, median)
## 
##   # Using lambdas
##   list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
## This warning is displayed once per session.
stats2 <- chldata %>% group_by(Water, Fungus) %>% select(Chl.b) %>% summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))
## Adding missing grouping variables: `Water`, `Fungus`
stats3 <- chldata %>% group_by(Water, Fungus) %>% select(Chl.b.a.ratio) %>% summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd)) 
## Adding missing grouping variables: `Water`, `Fungus`
stats4 <- chldata %>% group_by(Water, Fungus) %>% select(Total) %>% summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))
## Adding missing grouping variables: `Water`, `Fungus`
stats %>% kable() %>% kable_styling(full_width = F) %>% add_header_above(c(" " = 2, "Chl a" = 7)) %>% collapse_rows()
Chl a
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 1.3785 1.438375 1.64465 1.845525 2.4325 1.730400 0.3969141
Cer 2.4034 2.659700 2.91600 3.172300 3.4286 2.916000 0.7249259
Cok 4.2542 4.348175 4.44215 4.536125 4.6301 4.442150 0.2658014
Ctrl 0.6543 2.416075 2.74235 2.996475 4.1046 2.605350 1.1327896
Nig 1.3885 1.886175 2.97785 3.276550 4.0201 2.710450 1.0410501
Pen 1.4103 1.623000 1.99855 2.549825 3.0217 2.110083 0.6443822
Pod 2.2508 2.407100 3.64395 4.842250 4.8829 3.605400 1.4465113
Pre 2.5646 2.589350 2.64125 2.792350 3.1147 2.740450 0.2546096
Xyl 1.9925 2.196050 2.26565 2.330000 2.5178 2.260400 0.2145433
Low Asp 1.8032 2.282550 3.41230 3.680150 4.1644 3.077933 0.9724927
Cer 1.3056 1.858450 2.19620 2.475375 2.9348 2.157850 0.5733045
Cok 2.3816 2.930825 3.58330 4.209275 4.6790 3.556800 1.0136576
Ctrl 1.3706 2.521075 2.91315 3.413525 5.2171 3.064117 1.2833496
Nig 1.3661 1.783475 2.35900 3.125225 4.1147 2.549700 1.1977419
Pen 0.7559 1.814325 2.37305 3.791275 4.6496 2.673950 1.4901283
Pod 1.1815 1.904725 2.13075 3.335300 6.8223 2.971917 2.0599131
Pre 0.8341 0.970475 1.15580 3.003875 4.4658 2.023350 1.5892062
Xyl 1.4374 2.124750 2.81210 3.499450 4.1868 2.812100 1.9441194
stats2 %>% kable() %>% kable_styling(full_width = F) %>% add_header_above(c(" " = 2, "Chl b" = 7)) %>% collapse_rows()
Chl b
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 1.1578 1.802800 2.06590 2.651275 3.4807 2.221967 0.8188023
Cer 2.3279 2.979350 3.63080 4.282250 4.9337 3.630800 1.8425789
Cok 4.1675 4.628375 5.08925 5.550125 6.0110 5.089250 1.3035514
Ctrl 0.7493 2.652775 3.44605 4.228750 5.8297 3.391517 1.7540252
Nig 1.4517 1.897100 3.63340 4.264575 5.5941 3.350983 1.6580124
Pen 1.1784 2.192475 2.23820 2.712925 4.2843 2.497917 1.0301252
Pod 1.8431 2.224775 4.54235 6.762600 6.8523 4.445025 2.7190193
Pre 2.3051 2.662850 3.23910 3.894375 4.4892 3.318125 0.9708800
Xyl 1.9172 1.994675 2.64285 3.366050 3.6686 2.717875 0.8814486
Low Asp 2.1927 3.570600 5.40600 7.116375 9.3309 5.496817 2.6947445
Cer 1.1950 2.996500 3.61605 4.056800 5.5423 3.493850 1.4477185
Cok 2.6757 3.764025 4.33190 4.794500 5.5670 4.226625 1.1983699
Ctrl 1.4843 1.872325 3.38255 4.510275 5.0331 3.256267 1.5551574
Nig 2.2579 4.842175 5.99005 6.284650 6.3091 5.136775 1.9392895
Pen 0.9236 2.263875 2.80870 3.530525 6.3876 3.130333 1.8490598
Pod -0.1698 0.237575 1.50615 4.320025 5.2567 2.195317 2.4760652
Pre 0.8355 1.220800 1.75545 2.810150 6.3290 2.479950 2.0534522
Xyl 5.7141 5.869250 6.02440 6.179550 6.3347 6.024400 0.4388305
stats3 %>% kable() %>% kable_styling(full_width = F) %>% add_header_above(c(" " = 2, "Chl b/a" = 7)) %>% collapse_rows()
Chl b/a
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 0.8399000 1.0947000 1.345747 1.473605 1.513249 1.261981 0.2721681
Cer 0.9686000 1.0861968 1.203794 1.321390 1.438987 1.203794 0.3326139
Cok 0.9001000 1.0283148 1.156530 1.284744 1.412959 1.156530 0.3626463
Ctrl 1.0730000 1.1162250 1.277402 1.411244 1.420294 1.261076 0.1690156
Nig 0.8948000 0.9843500 1.245312 1.409754 1.446971 1.199054 0.2498186
Pen 0.8204000 0.8932000 1.242076 1.456214 1.484446 1.182250 0.3142204
Pod 0.8189000 0.9220250 1.175364 1.396577 1.403323 1.143238 0.3004410
Pre 0.8585000 1.0282250 1.253842 1.427493 1.441321 1.201876 0.2815388
Xyl 0.8925000 0.9447750 1.201136 1.444321 1.457067 1.187960 0.3023483
Low Asp 0.8165000 1.2490922 1.397398 2.129357 4.745607 1.988317 1.4430095
Cer 0.9153000 1.2432041 1.441539 1.852052 2.742500 1.617810 0.6550962
Cok 0.8820000 1.0631250 1.248568 1.394481 1.457018 1.209038 0.2600366
Ctrl 0.5008402 0.9324500 1.133150 1.357552 1.460632 1.087613 0.3580767
Nig 1.1744000 1.3332090 1.821573 2.841354 4.594418 2.352991 1.5660008
Pen 0.8517000 0.9573000 1.297849 1.408012 1.489756 1.204278 0.2805299
Pod -0.0844468 0.1964067 1.026300 1.360309 2.335800 0.949229 0.9190565
Pre 0.8746000 0.9963500 1.335999 1.474218 1.545791 1.249302 0.2936034
Xyl 1.3647763 2.1253072 2.885838 3.646369 4.406900 2.885838 2.1511063
stats4 %>% kable() %>% kable_styling(full_width = F,) %>% add_header_above(c(" " = 2, "Total Chlorophyll" = 7)) %>% collapse_rows()
Total Chlorophyll
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 2.5363 3.311200 3.71055 4.426775 5.9132 3.952367 1.184572
Cer 4.7313 5.639050 6.54680 7.454550 8.3623 6.546800 2.567505
Cok 8.7976 9.164500 9.53140 9.898300 10.2652 9.531400 1.037750
Ctrl 1.4036 5.068850 6.18840 7.225225 9.9343 5.996867 2.870463
Nig 2.9146 3.833050 6.78635 7.260450 9.6142 6.061433 2.640505
Pen 2.5887 3.875550 4.52275 4.916675 7.3060 4.608000 1.573892
Pod 4.0939 4.631875 8.18630 11.604850 11.7352 8.050425 4.165380
Pre 4.9900 5.257525 5.82020 6.621250 7.6039 6.058575 1.167894
Xyl 3.9097 4.190725 4.90850 5.696050 6.1864 4.978275 1.063039
Low Asp 3.9959 7.250750 9.28470 10.581175 11.2971 8.574750 2.771967
Cer 2.5006 5.226200 5.77320 6.885400 7.5632 5.651700 1.806590
Cok 5.0573 7.002500 8.22835 9.009275 9.6197 7.783425 1.988842
Ctrl 3.0058 4.583650 6.01750 8.208475 9.8370 6.320383 2.620370
Nig 4.1805 6.777075 8.37355 9.282950 9.8183 7.686475 2.506609
Pen 1.6795 4.293075 5.07940 7.209275 11.0372 5.804283 3.241293
Pod 1.8412 2.814625 5.06620 7.297150 8.9249 5.167233 2.912251
Pre 1.7535 2.128350 2.91125 5.814025 10.7948 4.503300 3.583994
Xyl 7.7721 8.304300 8.83650 9.368700 9.9009 8.836500 1.505289
  1. Run Linear models in RRPP for each fungal treatment and estimate model coefficients. “d” is the amount of change in a variable for the coefficient indicated.
high <- chldata %>% filter(Water=="High") %>% droplevels.data.frame()
low <- chldata %>% filter(Water=="Low") %>% droplevels.data.frame()

# chl b/a ratio linear models and coefficient tests
highLM <- lm.rrpp(Chl.b.a.ratio ~ Block*Fungus*Age, data=high, SS.type="III", print.progress=F) ; summary(highLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 2.392622  0.01395011 0.9942033 44.26136
##                      Z (from F) Pr(>F)
## Block * Fungus * Age   7.565094  0.001
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##                Trace Proportion Rank
## Fitted    0.06134928  0.9942034    1
## Residuals 0.00035770  0.0057968    1
## Total     0.06170697  1.0000000    1
## 
## Eigenvalues
## 
##                  PC1
## Fitted    0.06134928
## Residuals 0.00035770
## Total     0.06170697
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                                d.obs  UCL (95%)          Zd Pr(>d)
## (Intercept)               0.62593333 0.78240545 -1.61026300  0.940
## Block                     0.21035000 0.10644294  6.17690316  0.001
## FungusCer                 0.13231667 0.13025502  2.03270522  0.047
## FungusCok                 0.06381667 0.13567589  0.34866901  0.309
## FungusCtrl                0.44870000 0.21121828  5.32948001  0.001
## FungusNig                 0.14976667 0.20847996  1.03705091  0.159
## FungusPen                 0.03556667 0.20911076 -0.69398103  0.694
## FungusPod                 0.46796667 0.25391620  4.60884320  0.001
## FungusPre                 0.11941667 0.20343556  0.59221237  0.251
## FungusXyl                 0.19686667 0.26144524  1.21008749  0.124
## AgeYoung                  0.76904060 0.28815474  7.38986713  0.001
## Block:FungusCtrl          0.19355000 0.09351292  5.20915960  0.001
## Block:FungusNig           0.10820000 0.09778119  2.32840271  0.032
## Block:FungusPen           0.08740000 0.08993824  1.86990070  0.055
## Block:FungusPod           0.34785000 0.14343138  6.07693157  0.001
## Block:FungusPre           0.09720000 0.08836244  2.13479907  0.033
## Block:FungusXyl           0.14065000 0.14044561  1.90008510  0.050
## Block:AgeYoung            0.16917263 0.06077501  7.02633383  0.001
## FungusCer:AgeYoung        0.12948086 0.13349893  1.77002306  0.058
## FungusCok:AgeYoung        0.08700861 0.13480982  0.75017254  0.219
## FungusCtrl:AgeYoung       0.41916536 0.21472050  5.08899738  0.001
## FungusNig:AgeYoung        0.09549141 0.21626233  0.08565683  0.394
## FungusPen:AgeYoung        0.02459043 0.21354610 -0.97526937  0.823
## FungusPod:AgeYoung        0.47760590 0.26753430  4.38983017  0.001
## FungusPre:AgeYoung        0.10072544 0.20879287  0.18385219  0.382
## FungusXyl:AgeYoung        0.16876311 0.26846199  0.66919439  0.251
## Block:FungusCtrl:AgeYoung 0.14707756 0.08723097  4.09145843  0.003
## Block:FungusNig:AgeYoung  0.05145228 0.08926494  0.54736940  0.269
## Block:FungusPen:AgeYoung  0.07179740 0.08828676  1.28525319  0.118
## Block:FungusPod:AgeYoung  0.31566678 0.14426725  5.85033910  0.001
## Block:FungusPre:AgeYoung  0.06524132 0.08845217  1.07151266  0.153
## Block:FungusXyl:AgeYoung  0.11646746 0.14196521  1.32866227  0.117
lowLM <- lm.rrpp(Chl.b.a.ratio ~ Block*Fungus*Age, data=low, SS.type="III", print.progress=F) ; summary(lowLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 38.48417    4.291964 0.8996645 3.260568
##                      Z (from F) Pr(>F)
## Block * Fungus * Age   1.596751  0.058
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    0.8552037  0.8996645    1
## Residuals 0.0953770  0.1003355    1
## Total     0.9505807  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    0.8552037
## Residuals 0.0953770
## Total     0.9505807
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                                 d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               2.604166667 2.3812771  2.20410896  0.033
## Block                     0.570500000 0.5182633  2.39472974  0.023
## FungusCer                 0.569933333 2.5153066 -0.43813451  0.582
## FungusCok                 1.963666667 3.1369098  0.75802946  0.163
## FungusCtrl                1.861066667 2.4327801  1.17769678  0.102
## FungusNig                 0.194133333 2.6074282 -0.88687596  0.863
## FungusPen                 1.976066667 2.5036802  1.27796647  0.104
## FungusPod                 0.004266667 2.5230863 -1.14346043  0.998
## FungusPre                 1.971166667 2.4519874  1.32155944  0.094
## FungusXyl                 2.373233333 1.5507146  3.30853828  0.025
## AgeYoung                  3.487937297 1.8351196  4.70526110  0.001
## Block:FungusCer           0.210000000 0.7316576 -0.42391780  0.590
## Block:FungusCok           0.812000000 1.1892988  0.92705073  0.173
## Block:FungusCtrl          0.724250000 0.7455906  1.81465289  0.057
## Block:FungusNig           0.029200000 0.7266514 -1.20670602  0.932
## Block:FungusPen           0.746900000 0.7732649  1.79272389  0.060
## Block:FungusPod           0.001950000 0.7500426 -1.37779019  0.998
## Block:FungusPre           0.760600000 0.7510175  2.00685659  0.046
## Block:AgeYoung            2.269119123 0.9889150  5.82392308  0.001
## FungusCer:AgeYoung        1.380191764 3.2901755  0.02929035  0.408
## FungusCok:AgeYoung        4.137690011 4.1991110  1.85918413  0.054
## FungusCtrl:AgeYoung       4.781024939 3.3113151  3.27755878  0.008
## FungusNig:AgeYoung        0.471646460 3.2815666 -0.89368918  0.799
## FungusPen:AgeYoung        4.241875805 3.4237166  2.69264946  0.018
## FungusPod:AgeYoung        2.760631578 3.3447833  1.37856771  0.109
## FungusPre:AgeYoung        4.264315316 3.4016271  2.88634671  0.018
## FungusXyl:AgeYoung        1.823305527 2.0418265  1.51061262  0.083
## Block:FungusCer:AgeYoung  1.210536461 1.5631762  1.25734412  0.122
## Block:FungusCok:AgeYoung  2.427236353 2.3633451  2.01267211  0.044
## Block:FungusCtrl:AgeYoung 2.878650458 1.5046734  4.79128042  0.001
## Block:FungusNig:AgeYoung  0.123682936 1.4894862 -1.08974218  0.884
## Block:FungusPen:AgeYoung  2.422709974 1.5582108  3.76434507  0.002
## Block:FungusPod:AgeYoung  2.419037276 1.5234606  3.83380075  0.002
## Block:FungusPre:AgeYoung  2.421205917 1.5330067  3.91195236  0.001
  1. Run ANOVA in RRPP for each linear model.
# chl b/a ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(highANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df      SS       MS      Rsq       F        Z Pr(>F)   
## Block             1 0.08849 0.088494 0.036772 50.7490           0.002 **
## Fungus            8 0.07465 0.009331 0.031019  0.8201 -0.47624  0.671   
## Age               1 0.12673 0.126734 0.052661 29.0071           0.023 * 
## Block:Fungus      6 0.06827 0.011378 0.028368  6.5250  1.77838  0.036 * 
## Block:Age         1 0.02862 0.028619 0.011892  6.5505           0.025 * 
## Fungus:Age        8 0.03616 0.004520 0.015025  1.0345 -0.42391  0.658   
## Block:Fungus:Age  6 0.02621 0.004369 0.010893  2.5055  1.16914  0.104   
## Residuals         8 0.01395 0.001744 0.005797                           
## Total            39 2.40657                                             
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b.a.ratio ~ Block * Fungus * Age, SS.type = "III",  
##     data = high, print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(lowANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS     MS      Rsq      F        Z Pr(>F)  
## Block             1  0.651 0.6509 0.015217 1.8200           0.215  
## Fungus            8 10.522 1.3153 0.245979 3.9387  0.88560  0.196  
## Age               1  2.607 2.6069 0.060944 2.1006  1.16837  0.088 .
## Block:Fungus      7  2.338 0.3339 0.054645 0.9336  0.00261  0.480  
## Block:Age         1  5.149 5.1489 0.120369 4.1489           0.036 *
## Fungus:Age        8  9.881 1.2351 0.230997 0.9953 -0.21371  0.566  
## Block:Fungus:Age  7  8.687 1.2410 0.203084 3.4698  1.83670  0.034 *
## Residuals        12  4.292 0.3577 0.100336                         
## Total            45 42.776                                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b.a.ratio ~ Block * Fungus * Age, SS.type = "III",  
##     data = low, print.progress = F)
  1. Test pairwise differences between least squares means. Similar to tukeyHSD function in the r stats package. The pairwise function will generate tables with confidence intervals and p‐values for the pairwise statistic, Euclidean distance between least‐squares means.
# chl b/a ratio pairwise
highpw <- pairwise(highLM, groups = high$Fungus) ; summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                    d  UCL (95%)            Z Pr > d
## Asp:Cer  0.058187450 0.10320322 -0.044024032  0.502
## Asp:Cok  0.105451323 0.14814480  0.041087763  0.459
## Asp:Ctrl 0.000905116 0.03538716 -1.237179248  0.954
## Asp:Nig  0.062926762 0.09129584  0.021800062  0.496
## Asp:Pen  0.079731152 0.10842561  0.010537412  0.484
## Asp:Pod  0.118743037 0.15235664  0.016767643  0.505
## Asp:Pre  0.060104737 0.09291459  0.004794364  0.505
## Asp:Xyl  0.074021132 0.10700516  0.015703933  0.489
## Cer:Cok  0.047263873 0.10101312  0.002161435  0.472
## Cer:Ctrl 0.057282333 0.10012902 -0.042094826  0.514
## Cer:Nig  0.004739313 0.04883312 -1.076294211  0.872
## Cer:Pen  0.021543703 0.06225822 -0.286323700  0.553
## Cer:Pod  0.060555587 0.10416286  0.035535283  0.479
## Cer:Pre  0.001917287 0.05311203 -1.220478644  0.946
## Cer:Xyl  0.015833683 0.06087528 -0.489894704  0.619
## Cok:Ctrl 0.104546207 0.14777001  0.040224596  0.475
## Cok:Nig  0.042524561 0.08314593 -0.012700058  0.487
## Cok:Pen  0.025720171 0.06850836 -0.157550447  0.499
## Cok:Pod  0.013291714 0.06150881 -0.636031187  0.681
## Cok:Pre  0.045346586 0.08738173  0.009293654  0.484
## Cok:Xyl  0.031430191 0.07517390 -0.125850341  0.503
## Ctrl:Nig 0.062021646 0.08977578  0.020903726  0.481
## Ctrl:Pen 0.078826036 0.10927781  0.009019397  0.490
## Ctrl:Pod 0.117837921 0.15023118  0.015882660  0.492
## Ctrl:Pre 0.059199621 0.09347071  0.003756734  0.493
## Ctrl:Xyl 0.073116016 0.10799845  0.014913400  0.504
## Nig:Pen  0.016804390 0.04686381 -0.245379009  0.530
## Nig:Pod  0.055816275 0.09024489 -0.003497201  0.494
## Nig:Pre  0.002822025 0.03919538 -1.143384126  0.894
## Nig:Xyl  0.011094370 0.04488742 -0.556207991  0.651
## Pen:Pod  0.039011885 0.07297390 -0.013586489  0.490
## Pen:Pre  0.019626415 0.05038415 -0.231720558  0.549
## Pen:Xyl  0.005710020 0.04160410 -0.957946450  0.823
## Pod:Pre  0.058638300 0.09500790  0.009237436  0.496
## Pod:Xyl  0.044721905 0.08167184 -0.011530614  0.502
## Pre:Xyl  0.013916396 0.05103364 -0.428795664  0.587
highpw2 <- pairwise(highLM, groups = high$Age) ; summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)           Z Pr > d
## Old:Young 0.4570754 0.4736502 0.006216987  0.498
lowpw <- pairwise(lowLM, groups = low$Fungus) ; summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                    d UCL (95%)             Z Pr > d
## Asp:Cer  0.370507246 0.8853904 -0.1478610225  0.510
## Asp:Cok  0.779278707 1.3278286 -0.0301422487  0.513
## Asp:Ctrl 0.900704655 1.4166997  0.0486720988  0.485
## Asp:Nig  0.364673628 0.9258853 -0.1976350688  0.536
## Asp:Pen  0.784038739 1.2985573  0.0088839580  0.495
## Asp:Pod  1.039088154 1.5506775  0.0209061636  0.481
## Asp:Pre  0.739014926 1.2434961 -0.0191867912  0.505
## Asp:Xyl  0.897521008 1.6177589 -0.0001802989  0.475
## Cer:Cok  0.408771460 0.9782648 -0.1582706790  0.527
## Cer:Ctrl 0.530197409 1.0277899  0.0238848355  0.478
## Cer:Nig  0.735180874 1.3045299 -0.0315741826  0.511
## Cer:Pen  0.413531493 0.9050760 -0.0688173046  0.483
## Cer:Pod  0.668580908 1.1598071  0.0258294564  0.487
## Cer:Pre  0.368507680 0.8352309 -0.1049670821  0.503
## Cer:Xyl  1.268028254 2.0212365  0.0033059568  0.467
## Cok:Ctrl 0.121425948 0.7199995 -0.7945657985  0.753
## Cok:Nig  1.143952335 1.7831922 -0.0328399848  0.541
## Cok:Pen  0.004760032 0.6678481 -1.3446792124  0.992
## Cok:Pod  0.259809448 0.7947886 -0.3253185841  0.556
## Cok:Pre  0.040263781 0.6994316 -1.1684395589  0.926
## Cok:Xyl  1.676799715 2.4291577 -0.0067111061  0.504
## Ctrl:Nig 1.265378283 1.8612714  0.0336356330  0.491
## Ctrl:Pen 0.116665916 0.6621089 -0.7131360410  0.722
## Ctrl:Pod 0.138383499 0.6261081 -0.6820100797  0.697
## Ctrl:Pre 0.161689729 0.6341678 -0.5632679557  0.635
## Ctrl:Xyl 1.798225663 2.4793894  0.0473879461  0.481
## Nig:Pen  1.148712367 1.7261930 -0.0020162903  0.496
## Nig:Pod  1.403761782 1.9775184  0.0071805840  0.497
## Nig:Pre  1.103688554 1.6846964 -0.0219302947  0.507
## Nig:Xyl  0.532847380 1.3106403 -0.0995566621  0.491
## Pen:Pod  0.255049415 0.7280045 -0.2874635575  0.553
## Pen:Pre  0.045023813 0.6042290 -1.0595525678  0.870
## Pen:Xyl  1.681559747 2.4276324  0.0190719930  0.472
## Pod:Pre  0.300073228 0.7769037 -0.2061556458  0.526
## Pod:Xyl  1.936609162 2.6851716  0.0257284921  0.473
## Pre:Xyl  1.636535934 2.3562280  0.0036599286  0.477
lowpw2 <- pairwise(lowLM, groups = low$Age) ; summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)          Z Pr > d
## Old:Young 0.1482125 0.4063939 -0.2117849  0.515
  1. Examine RRPP plots to check for assumptions.
## chl b/a ratio
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, low$Fungus))

  1. Repeat steps 4 - 7 for chlorophyll a and b
## chl a
# linear models and coefficient tests
highLM <- lm.rrpp(Chl.a ~ Block*Fungus*Age, data=high, SS.type="III", print.progress=F) ; summary(highLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 34.62868    4.896895 0.8761082 1.824918
##                      Z (from F) Pr(>F)
## Block * Fungus * Age  0.8611391  0.191
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    0.8879149  0.8761082    1
## Residuals 0.1255614  0.1238918    1
## Total     1.0134763  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    0.8879149
## Residuals 0.1255614
## Total     1.0134763
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               1.4887000 3.1132605 -0.88671633  0.844
## Block                     0.0189000 0.5625146 -0.98230634  0.800
## FungusCer                 0.8958000 1.7774671  0.66888479  0.181
## FungusCok                 3.1225000 1.6911105  4.86491341  0.003
## FungusCtrl                0.4613333 2.7235718 -0.58767526  0.646
## FungusNig                 2.5825333 2.4298071  2.25902054  0.045
## FungusPen                 1.2428667 2.3409168  0.54841450  0.238
## FungusPod                 1.1789000 3.1386469  0.10645855  0.327
## FungusPre                 1.2563500 2.7923820  0.39384042  0.248
## FungusXyl                 1.0466000 3.3762310 -0.08388678  0.398
## AgeYoung                  1.3735000 1.6506508  1.43495466  0.099
## Block:FungusCtrl          0.0708500 0.7875661 -1.01948406  0.868
## Block:FungusNig           1.0067000 0.7849443  2.89710866  0.009
## Block:FungusPen           0.3558500 0.7568903  0.17981382  0.374
## Block:FungusPod           0.2273000 1.2103392 -0.67305703  0.706
## Block:FungusPre           0.0790500 0.7999934 -0.95453805  0.853
## Block:FungusXyl           0.2903000 1.3270783 -0.47649035  0.604
## Block:AgeYoung            0.4828500 0.7235837  0.84909850  0.191
## FungusCer:AgeYoung        0.1345500 1.6145549 -1.03855928  0.867
## FungusCok:AgeYoung        1.2665500 1.6356655  1.18829425  0.134
## FungusCtrl:AgeYoung       1.1549333 2.7405931  0.06908845  0.393
## FungusNig:AgeYoung        2.1915667 2.7141535  1.33164332  0.115
## FungusPen:AgeYoung        0.8735667 2.5730234 -0.26025976  0.518
## FungusPod:AgeYoung        0.7334000 3.2372444 -0.60698556  0.671
## FungusPre:AgeYoung        1.7795000 2.6980775  0.85127825  0.193
## FungusXyl:AgeYoung        1.8918000 3.3456213  0.56228249  0.240
## Block:FungusCtrl:AgeYoung 0.0221500 1.1421181 -1.29161849  0.977
## Block:FungusNig:AgeYoung  1.5067000 1.1835913  2.78562240  0.011
## Block:FungusPen:AgeYoung  0.2853000 1.1521380 -0.56824518  0.656
## Block:FungusPod:AgeYoung  0.7454500 1.7567748  0.05991203  0.410
## Block:FungusPre:AgeYoung  0.8015500 1.1512449  0.95806001  0.174
## Block:FungusXyl:AgeYoung  1.0046500 1.8482219  0.47163597  0.267
lowLM <- lm.rrpp(Chl.a ~ Block*Fungus*Age, data=low, SS.type="III", print.progress=F) ; summary(lowLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 67.19567    13.12627 0.8365793 1.861519
##                      Z (from F) Pr(>F)
## Block * Fungus * Age   1.033254  0.139
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    1.4932372  0.8365793    1
## Residuals 0.2916948  0.1634207    1
## Total     1.7849320  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    1.4932372
## Residuals 0.2916948
## Total     1.7849320
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)         Zd Pr(>d)
## (Intercept)               4.3430667 6.5795080 -0.5677956  0.736
## Block                     0.7142000 0.9534942  1.5016766  0.083
## FungusCer                 2.7943333 3.2320490  1.5055108  0.085
## FungusCok                 2.6333333 4.2156378  0.7341268  0.213
## FungusCtrl                2.5017333 3.3287671  1.1785583  0.134
## FungusNig                 1.1112667 3.5222104 -0.2301015  0.501
## FungusPen                 1.6043667 3.3251946  0.2064703  0.361
## FungusPod                 1.5069667 3.4805683  0.1252120  0.374
## FungusPre                 0.2210000 3.3565091 -1.0215211  0.881
## FungusXyl                 2.1914667 2.0939637  2.1208716  0.042
## AgeYoung                  1.0963333 2.5607897  0.1976930  0.323
## Block:FungusCer           0.8895000 1.3143093  0.8830000  0.197
## Block:FungusCok           1.5832000 2.0953984  1.1345885  0.144
## Block:FungusCtrl          1.2090500 1.2828312  1.6897109  0.067
## Block:FungusNig           0.2778000 1.3244636 -0.6598018  0.695
## Block:FungusPen           1.0023500 1.3873875  0.9907349  0.164
## Block:FungusPod           0.1797000 1.3821395 -0.9159896  0.796
## Block:FungusPre           0.6740500 1.2605982  0.3783323  0.298
## Block:AgeYoung            0.3849000 1.1710396 -0.1370970  0.446
## FungusCer:AgeYoung        0.9018000 4.1265671 -0.6110257  0.664
## FungusCok:AgeYoung        3.0812333 5.0500914  0.5812771  0.263
## FungusCtrl:AgeYoung       4.2113000 4.2977626  1.8382194  0.058
## FungusNig:AgeYoung        1.1608667 4.0980392 -0.3985153  0.571
## FungusPen:AgeYoung        1.2637000 4.2613209 -0.2857590  0.518
## FungusPod:AgeYoung        2.8811000 4.2696158  0.9053959  0.175
## FungusPre:AgeYoung        0.1191667 4.1067099 -1.2141235  0.962
## FungusXyl:AgeYoung        2.0379667 2.5317165  1.2242357  0.113
## Block:FungusCer:AgeYoung  0.3556500 1.9430340 -0.7476500  0.728
## Block:FungusCok:AgeYoung  1.7435000 3.0711511  0.5126096  0.268
## Block:FungusCtrl:AgeYoung 2.0082000 2.0210904  1.9235037  0.055
## Block:FungusNig:AgeYoung  0.5530000 1.9265238 -0.3930890  0.560
## Block:FungusPen:AgeYoung  0.6282000 1.9548830 -0.2591984  0.505
## Block:FungusPod:AgeYoung  2.4821000 2.0151741  2.7198075  0.011
## Block:FungusPre:AgeYoung  0.1321000 1.9961832 -1.0811244  0.885
# ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(highANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)
## Block             1  0.001 0.00071 0.000018 0.0012           0.843
## Fungus            8  6.835 0.85442 0.172936 3.6871  0.81970  0.207
## Age               1  0.404 0.40425 0.010228 1.3942           0.223
## Block:Fungus      6  1.390 0.23174 0.035178 0.3786 -0.91017  0.813
## Block:Age         1  0.233 0.23314 0.005899 0.8041           0.339
## Fungus:Age        8  2.416 0.30205 0.061134 1.0417 -0.17869  0.556
## Block:Fungus:Age  6  1.740 0.28994 0.044013 0.4737 -0.82082  0.817
## Residuals         8  4.897 0.61211 0.123892                       
## Total            39 39.526                                        
## 
## Call: lm.rrpp(f1 = Chl.a ~ Block * Fungus * Age, SS.type = "III", data = high,  
##     print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(lowANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)
## Block             1  1.020 1.02016 0.012701 0.9326           0.287
## Fungus            8 14.156 1.76956 0.176246 1.5751  0.34461  0.330
## Age               1  0.258 0.25756 0.003207 0.2084  0.08224  0.542
## Block:Fungus      7  7.864 1.12346 0.097909 1.0271  0.06854  0.469
## Block:Age         1  0.148 0.14815 0.001844 0.1199           0.648
## Fungus:Age        8  8.488 1.06096 0.105671 0.8586 -0.27319  0.623
## Block:Fungus:Age  7  8.649 1.23563 0.107684 1.1296  0.15859  0.444
## Residuals        12 13.126 1.09386 0.163421                       
## Total            45 80.322                                        
## 
## Call: lm.rrpp(f1 = Chl.a ~ Block * Fungus * Age, SS.type = "III", data = low,  
##     print.progress = F)
# pairwise
highpw <- pairwise(highLM, groups = high$Fungus) ; summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)             Z Pr > d
## Asp:Cer  1.1856000 1.7444579 -0.0397153304  0.529
## Asp:Cok  2.7117500 3.2527296 -0.0138542613  0.524
## Asp:Ctrl 0.8749500 1.2538255  0.0044563947  0.513
## Asp:Nig  0.9800500 1.3816918 -0.0173411982  0.519
## Asp:Pen  0.3796833 0.7757114 -0.1107287911  0.510
## Asp:Pod  1.8750000 2.2842005  0.0036071225  0.509
## Asp:Pre  1.0100500 1.4193045 -0.0263544834  0.522
## Asp:Xyl  0.5300000 0.9526171 -0.0065051864  0.499
## Cer:Cok  1.5261500 2.1563458  0.0217534315  0.521
## Cer:Ctrl 0.3106500 0.8739857 -0.3158461812  0.587
## Cer:Nig  0.2055500 0.7563966 -0.5139173573  0.636
## Cer:Pen  0.8059167 1.3612361 -0.0010300757  0.506
## Cer:Pod  0.6894000 1.2618955  0.0155048542  0.488
## Cer:Pre  0.1755500 0.7747262 -0.6314269116  0.670
## Cer:Xyl  0.6556000 1.2782708 -0.0756869893  0.505
## Cok:Ctrl 1.8368000 2.3667611 -0.0172371496  0.516
## Cok:Nig  1.7317000 2.2762065 -0.0015446047  0.519
## Cok:Pen  2.3320667 2.8416513  0.0340602484  0.511
## Cok:Pod  0.8367500 1.4346393 -0.0192224934  0.511
## Cok:Pre  1.7017000 2.2525063  0.0063877794  0.505
## Cok:Xyl  2.1817500 2.7618799 -0.0257520695  0.517
## Ctrl:Nig 0.1051000 0.5202463 -0.6938997811  0.706
## Ctrl:Pen 0.4952667 0.8692005  0.0585394076  0.469
## Ctrl:Pod 1.0000500 1.4013555 -0.0003978616  0.525
## Ctrl:Pre 0.1351000 0.5844879 -0.6359027729  0.677
## Ctrl:Xyl 0.3449500 0.8074781 -0.1043138089  0.490
## Nig:Pen  0.6003667 0.9585536  0.0489269640  0.483
## Nig:Pod  0.8949500 1.3359137  0.0185405734  0.494
## Nig:Pre  0.0300000 0.5394487 -1.1504355699  0.929
## Nig:Xyl  0.4500500 0.9370759 -0.0728146707  0.512
## Pen:Pod  1.4953167 1.9238148  0.0628278002  0.471
## Pen:Pre  0.6303667 1.0312906  0.0285803512  0.505
## Pen:Xyl  0.1503167 0.5646290 -0.5158031070  0.630
## Pod:Pre  0.8649500 1.3322021  0.0255257998  0.483
## Pod:Xyl  1.3450000 1.8434605 -0.0118110166  0.489
## Pre:Xyl  0.4800500 0.9827610 -0.0830715955  0.502
highpw2 <- pairwise(highLM, groups = high$Age) ; summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                 d UCL (95%)           Z Pr > d
## Old:Young 0.82123  1.037333 -0.02091859  0.511
lowpw <- pairwise(lowLM, groups = low$Fungus) ; summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)            Z Pr > d
## Asp:Cer  0.92008333 1.5637361  0.034915227  0.486
## Asp:Cok  0.47886667 1.2148622 -0.237263641  0.544
## Asp:Ctrl 0.01381667 0.8055051 -1.284002224  0.974
## Asp:Nig  0.52823333 1.2857103 -0.142772260  0.516
## Asp:Pen  0.40398333 1.0660547 -0.185969668  0.499
## Asp:Pod  0.10601667 0.8330731 -0.912835344  0.809
## Asp:Pre  1.05458333 1.6798158  0.055895891  0.479
## Asp:Xyl  0.26583333 1.2734648 -0.611330189  0.661
## Cer:Cok  1.39895000 2.1223384 -0.001324945  0.510
## Cer:Ctrl 0.90626667 1.5679645  0.019518183  0.488
## Cer:Nig  0.39185000 1.1775226 -0.267746528  0.528
## Cer:Pen  0.51610000 1.1430992 -0.094326711  0.508
## Cer:Pod  0.81406667 1.4922583 -0.014336746  0.510
## Cer:Pre  0.13450000 0.7951180 -0.779960179  0.740
## Cer:Xyl  0.65425000 1.5515824 -0.117681477  0.490
## Cok:Ctrl 0.49268333 1.2511124 -0.196753111  0.534
## Cok:Nig  1.00710000 1.8471925 -0.045723063  0.489
## Cok:Pen  0.88285000 1.6387334 -0.019665302  0.490
## Cok:Pod  0.58488333 1.3201755 -0.098747059  0.498
## Cok:Pre  1.53345000 2.2844860  0.013598997  0.504
## Cok:Xyl  0.74470000 1.7943119 -0.192932164  0.547
## Ctrl:Nig 0.51441667 1.2486167 -0.159330575  0.511
## Ctrl:Pen 0.39016667 1.0559846 -0.201126915  0.533
## Ctrl:Pod 0.09220000 0.7990792 -0.938361296  0.811
## Ctrl:Pre 1.04076667 1.6776556  0.044181027  0.503
## Ctrl:Xyl 0.25201667 1.2459252 -0.646607176  0.688
## Nig:Pen  0.12425000 0.9377064 -0.884333831  0.799
## Nig:Pod  0.42221667 1.2071220 -0.265216655  0.530
## Nig:Pre  0.52635000 1.2571673 -0.095886477  0.481
## Nig:Xyl  0.26240000 1.3506374 -0.641769147  0.698
## Pen:Pod  0.29796667 0.9418610 -0.378561888  0.576
## Pen:Pre  0.65060000 1.2658125 -0.027096504  0.502
## Pen:Xyl  0.13815000 1.1938933 -0.859080303  0.788
## Pod:Pre  0.94856667 1.5939658  0.010123718  0.485
## Pod:Xyl  0.15981667 1.2629318 -0.856348834  0.782
## Pre:Xyl  0.78875000 1.6942014 -0.034614641  0.475
lowpw2 <- pairwise(lowLM, groups = low$Age) ; summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)          Z Pr > d
## Old:Young 0.7019609  1.050308 0.01081928  0.496
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, low$Fungus))

## chl b
# linear models and coefficient tests
highLM <- lm.rrpp(Chl.b ~ Block*Fungus*Age, data=high, SS.type="III", print.progress=F) ; summary(highLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 87.50118    6.465898 0.9311898 3.492315
##                      Z (from F) Pr(>F)
## Block * Fungus * Age   2.036384  0.034
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    2.2436201  0.9311898    1
## Residuals 0.1657923  0.0688103    1
## Total     2.4094123  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    2.2436201
## Residuals 0.1657923
## Total     2.4094123
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               0.9718000 2.8586074 -1.03555526  0.846
## Block                     0.3138000 0.6370833  0.48006561  0.291
## FungusCer                 1.0423000 1.5886509  0.95618364  0.156
## FungusCok                 2.8819000 1.5980151  4.60564538  0.003
## FungusCtrl                1.0827667 2.5596319  0.13473711  0.357
## FungusNig                 2.5081667 2.3652114  2.19739768  0.038
## FungusPen                 0.9413333 2.3066913  0.09063560  0.366
## FungusPod                 1.8891000 3.0356122  0.79880817  0.186
## FungusPre                 1.0948000 2.6725431  0.17522571  0.336
## FungusXyl                 1.1520000 3.4087934 -0.02631461  0.390
## AgeYoung                  3.0766333 2.0489802  3.55937998  0.002
## Block:FungusCtrl          0.3293500 0.8954640 -0.14763723  0.484
## Block:FungusNig           1.0558000 0.8658242  2.64201607  0.011
## Block:FungusPen           0.3389500 0.8589332 -0.06408513  0.464
## Block:FungusPod           0.8227000 1.3600749  0.65215662  0.234
## Block:FungusPre           0.0753000 0.9176346 -1.01598028  0.871
## Block:FungusXyl           0.4171000 1.4458540 -0.30661780  0.531
## Block:AgeYoung            0.9157500 0.8609529  2.11985292  0.040
## FungusCer:AgeYoung        0.4449167 1.8168762 -0.47636122  0.610
## FungusCok:AgeYoung        0.3173833 1.7661016 -0.74526101  0.725
## FungusCtrl:AgeYoung       1.2420667 2.9113518  0.04990791  0.404
## FungusNig:AgeYoung        1.8611000 3.0423215  0.72779843  0.234
## FungusPen:AgeYoung        0.4409667 2.8346250 -0.85528411  0.770
## FungusPod:AgeYoung        0.6755667 3.5070109 -0.72511390  0.719
## FungusPre:AgeYoung        1.8436833 2.8716802  0.75353808  0.220
## FungusXyl:AgeYoung        2.3386333 3.6527518  0.82694472  0.185
## Block:FungusCtrl:AgeYoung 0.1244500 1.3340999 -1.06173665  0.865
## Block:FungusNig:AgeYoung  1.6630000 1.3789928  2.57631759  0.017
## Block:FungusPen:AgeYoung  0.2330000 1.3324569 -0.79560761  0.742
## Block:FungusPod:AgeYoung  1.5442500 2.0773416  1.14486290  0.139
## Block:FungusPre:AgeYoung  1.0738000 1.3315547  1.31612559  0.109
## Block:FungusXyl:AgeYoung  1.4224500 2.1255591  0.87637559  0.181
lowLM <- lm.rrpp(Chl.b ~ Block*Fungus*Age, data=low, SS.type="III", print.progress=F) ; summary(lowLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 183.9456    24.99044 0.8803919 2.676596
##                      Z (from F) Pr(>F)
## Block * Fungus * Age   1.937795  0.028
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##              Trace Proportion Rank
## Fitted    4.087680  0.8803919    1
## Residuals 0.555343  0.1196081    1
## Total     4.643023  0.9999999    1
## 
## Eigenvalues
## 
##                PC1
## Fitted    4.087680
## Residuals 0.555343
## Total     4.643023
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                                d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)                9.7034333  8.816860  2.33761312  0.016
## Block                      2.7120500  1.422906  4.74788676  0.001
## FungusCer                  3.7832333  3.768123  1.96151405  0.050
## FungusCok                  4.1255333  4.457614  1.60711471  0.077
## FungusCtrl                 3.7724667  3.819256  1.85177735  0.058
## FungusNig                  1.3687333  3.911751 -0.24312995  0.528
## FungusPen                  4.7273333  3.880863  2.59762256  0.017
## FungusPod                  3.1066000  3.901550  1.28390922  0.116
## FungusPre                  5.9124000  3.676641  3.75924811  0.003
## FungusXyl                  0.6566833  2.421600 -0.46066377  0.604
## AgeYoung                   6.7049333  3.942629  4.20728026  0.002
## Block:FungusCer            1.3418000  1.550478  1.51614632  0.095
## Block:FungusCok            1.2609500  2.364624  0.39779491  0.306
## Block:FungusCtrl           1.2197000  1.597281  1.14330704  0.137
## Block:FungusNig            0.6864500  1.642021  0.08730734  0.390
## Block:FungusPen            1.3535000  1.638861  1.36514635  0.105
## Block:FungusPod            0.7918000  1.517556  0.31453734  0.332
## Block:FungusPre            1.6565000  1.583976  2.10592274  0.036
## Block:AgeYoung             4.5699500  2.113529  5.55921594  0.001
## FungusCer:AgeYoung         5.2040333  6.041119  1.50370100  0.097
## FungusCok:AgeYoung         7.7240333  7.405409  2.05086828  0.038
## FungusCtrl:AgeYoung        7.8890333  6.050129  2.93704559  0.011
## FungusNig:AgeYoung         3.7873833  6.208656  0.69611436  0.220
## FungusPen:AgeYoung         9.7007000  6.213026  3.80655669  0.002
## FungusPod:AgeYoung         7.1257000  6.062376  2.59846744  0.020
## FungusPre:AgeYoung        10.7553667  6.072150  4.37963889  0.002
## FungusXyl:AgeYoung         1.5143833  3.614567  0.01095824  0.419
## Block:FungusCer:AgeYoung   3.5053500  3.096614  2.51432025  0.026
## Block:FungusCok:AgeYoung   4.1488500  4.741278  1.61552360  0.084
## Block:FungusCtrl:AgeYoung  4.8520000  2.971325  3.92849142  0.003
## Block:FungusNig:AgeYoung   2.2579000  2.970890  1.12751412  0.155
## Block:FungusPen:AgeYoung   5.1965000  3.174421  4.17789026  0.001
## Block:FungusPod:AgeYoung   5.3413500  2.962565  4.47570144  0.002
## Block:FungusPre:AgeYoung   5.7951500  3.018835  4.86979362  0.001
# ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(highANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)  
## Block             1  0.197 0.19694 0.002096 0.2437           0.611  
## Fungus            8  5.524 0.69044 0.058781 2.7711  0.83328  0.197  
## Age               1  2.028 2.02836 0.021586 5.0392  1.30952  0.044 *
## Block:Fungus      6  1.495 0.24916 0.015909 0.3083 -1.26420  0.894  
## Block:Age         1  0.839 0.83860 0.008924 2.0834           0.140  
## Fungus:Age        8  2.190 0.27375 0.023306 0.6801 -0.74888  0.796  
## Block:Fungus:Age  6  2.415 0.40251 0.025701 0.4980 -0.78923  0.793  
## Residuals         8  6.466 0.80824 0.068810                         
## Total            39 93.967                                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b ~ Block * Fungus * Age, SS.type = "III", data = high,  
##     print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(lowANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df      SS      MS      Rsq      F        Z Pr(>F)  
## Block             1  14.710 14.7104 0.070406 7.0637           0.034 *
## Fungus            8  11.605  1.4506 0.055542 2.7036  1.62775  0.070 .
## Age               1   9.633  9.6335 0.046107 2.5619  1.04319  0.089 .
## Block:Fungus      7   3.756  0.5365 0.017976 0.2576 -1.68648  0.945  
## Block:Age         1  20.884 20.8844 0.099956 5.5539           0.019 *
## Fungus:Age        8  19.625  2.4531 0.093927 0.6524 -0.70537  0.776  
## Block:Fungus:Age  7  26.322  3.7604 0.125983 1.8057  0.97428  0.160  
## Residuals        12  24.990  2.0825 0.119608                         
## Total            45 208.936                                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b ~ Block * Fungus * Age, SS.type = "III", data = low,  
##     print.progress = F)
# pairwise
highpw <- pairwise(highLM, groups = high$Fungus) ; summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)             Z Pr > d
## Asp:Cer  1.40883333 2.0532160 -0.0391402115  0.530
## Asp:Cok  2.86728333 3.5092806 -0.0134255369  0.527
## Asp:Ctrl 1.16955000 1.6009888  0.0033440133  0.489
## Asp:Nig  1.12901667 1.5862536 -0.0210603207  0.524
## Asp:Pen  0.27595000 0.7440610 -0.2560781352  0.546
## Asp:Pod  2.22305833 2.7093197  0.0020466769  0.512
## Asp:Pre  1.09615833 1.6013929 -0.0224875134  0.529
## Asp:Xyl  0.49590833 0.9711726 -0.0503802905  0.508
## Cer:Cok  1.45845000 2.1850596  0.0209170861  0.516
## Cer:Ctrl 0.23928333 0.8741738 -0.5177538498  0.643
## Cer:Nig  0.27981667 0.8940755 -0.4278919033  0.591
## Cer:Pen  1.13288333 1.7934800  0.0098670038  0.497
## Cer:Pod  0.81422500 1.4804144  0.0191380830  0.484
## Cer:Pre  0.31267500 0.9778259 -0.3690143297  0.580
## Cer:Xyl  0.91292500 1.6322366 -0.0459847725  0.500
## Cok:Ctrl 1.69773333 2.3133186 -0.0159375395  0.506
## Cok:Nig  1.73826667 2.3711863  0.0013238243  0.514
## Cok:Pen  2.59133333 3.1784924  0.0368552549  0.516
## Cok:Pod  0.64422500 1.3186784 -0.0638176448  0.517
## Cok:Pre  1.77112500 2.4275900  0.0038223452  0.509
## Cok:Xyl  2.37137500 3.0480770 -0.0160075182  0.512
## Ctrl:Nig 0.04053333 0.5490805 -1.1279636621  0.890
## Ctrl:Pen 0.89360000 1.3344906  0.0741060292  0.463
## Ctrl:Pod 1.05350833 1.5178074 -0.0009301432  0.519
## Ctrl:Pre 0.07339167 0.5959994 -0.9744038737  0.837
## Ctrl:Xyl 0.67364167 1.1927018 -0.0092211324  0.488
## Nig:Pen  0.85306667 1.2725337  0.0512371617  0.481
## Nig:Pod  1.09404167 1.6021957  0.0206345254  0.501
## Nig:Pre  0.03285833 0.6268016 -1.1470251872  0.915
## Nig:Xyl  0.63310833 1.1760572 -0.0365071319  0.512
## Pen:Pod  1.94710833 2.4327228  0.0649084515  0.477
## Pen:Pre  0.82020833 1.2881646  0.0397701337  0.491
## Pen:Xyl  0.21995833 0.7078684 -0.3647109876  0.579
## Pod:Pre  1.12690000 1.6651442  0.0217463297  0.487
## Pod:Xyl  1.72715000 2.3004922 -0.0017083427  0.484
## Pre:Xyl  0.60025000 1.1600314 -0.0558601571  0.495
highpw2 <- pairwise(highLM, groups = high$Age) ; summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)          Z Pr > d
## Old:Young 2.190885  2.437061 -0.0217629  0.516
lowpw <- pairwise(lowLM, groups = low$Fungus) ; summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)             Z Pr > d
## Asp:Cer  2.0029667  3.036590  0.0006948353  0.508
## Asp:Cok  1.2701917  2.449669 -0.0369686944  0.499
## Asp:Ctrl 2.2405500  3.208026  0.0591384880  0.485
## Asp:Nig  0.3600417  1.541545 -0.5661175530  0.642
## Asp:Pen  2.3664833  3.420721  0.0346965415  0.477
## Asp:Pod  3.3015000  4.329931  0.0381348759  0.496
## Asp:Pre  3.0168667  4.022630  0.0078963105  0.485
## Asp:Xyl  0.5275833  2.039301 -0.4596796837  0.588
## Cer:Cok  0.7327750  1.817063 -0.1786804299  0.519
## Cer:Ctrl 0.2375833  1.290320 -0.7064443750  0.706
## Cer:Nig  1.6429250  2.704958 -0.0025738725  0.520
## Cer:Pen  0.3635167  1.390792 -0.4524038522  0.593
## Cer:Pod  1.2985333  2.256281  0.0333987898  0.484
## Cer:Pre  1.0139000  1.982522 -0.0204402406  0.479
## Cer:Xyl  2.5305500  4.004337  0.0081304370  0.478
## Cok:Ctrl 0.9703583  2.116997 -0.0140104255  0.467
## Cok:Nig  0.9101500  2.106143 -0.1512865037  0.529
## Cok:Pen  1.0962917  2.151256 -0.0135297032  0.479
## Cok:Pod  2.0313083  3.148278  0.0424149024  0.475
## Cok:Pre  1.7466750  2.915110  0.0131353986  0.474
## Cok:Xyl  1.7977750  3.312103 -0.0238677671  0.497
## Ctrl:Nig 1.8805083  2.978263  0.0550075896  0.473
## Ctrl:Pen 0.1259333  1.216929 -1.0020940115  0.842
## Ctrl:Pod 1.0609500  2.034873 -0.0520971158  0.514
## Ctrl:Pre 0.7763167  1.818599 -0.1372043863  0.516
## Ctrl:Xyl 2.7681333  4.270618  0.0498277153  0.462
## Nig:Pen  2.0064417  3.137083  0.0329286981  0.477
## Nig:Pod  2.9414583  4.073581  0.0357682822  0.496
## Nig:Pre  2.6568250  3.772914  0.0086836026  0.484
## Nig:Xyl  0.8876250  2.423975 -0.1882226477  0.503
## Pen:Pod  0.9350167  1.975069 -0.0565680218  0.501
## Pen:Pre  0.6503833  1.666200 -0.2064797620  0.538
## Pen:Xyl  2.8940667  4.355614  0.0319462746  0.475
## Pod:Pre  0.2846333  1.295458 -0.6190877269  0.672
## Pod:Xyl  3.8290833  5.340200  0.0338894566  0.472
## Pre:Xyl  3.5444500  4.991688  0.0131360352  0.484
lowpw2 <- pairwise(lowLM, groups = low$Age) ; summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)          Z Pr > d
## Old:Young 1.035035  1.546003 0.01878663  0.489
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, low$Fungus))

## Total
# linear models and coefficient tests
highLM <- lm.rrpp(Total ~ Block*Fungus*Age, data=high, SS.type="III", print.progress=F) ; summary(highLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 221.9666    22.53375 0.9078376 2.542041
##                      Z (from F) Pr(>F)
## Block * Fungus * Age    1.45138  0.083
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##              Trace Proportion Rank
## Fitted    5.691452  0.9078375    1
## Residuals 0.577788  0.0921624    1
## Total     6.269241  1.0000000    1
## 
## Eigenvalues
## 
##                PC1
## Fitted    5.691452
## Residuals 0.577788
## Total     6.269241
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               2.4605000  5.965483 -0.95729564  0.842
## Block                     0.3327000  1.170195 -0.19550994  0.524
## FungusCer                 1.9381000  3.371012  0.81834791  0.168
## FungusCok                 6.0044000  3.262008  4.75793997  0.003
## FungusCtrl                1.5441000  5.092658 -0.23232550  0.491
## FungusNig                 5.0907000  4.756851  2.24948871  0.040
## FungusPen                 2.1842000  4.664580  0.33220964  0.292
## FungusPod                 3.0680000  6.215268  0.45468859  0.242
## FungusPre                 2.3511500  5.412914  0.29631293  0.283
## FungusXyl                 2.1986000  6.671164 -0.04890224  0.403
## AgeYoung                  4.4501333  3.592018  2.65381638  0.017
## Block:FungusCtrl          0.4002000  1.665440 -0.55555368  0.636
## Block:FungusNig           2.0625000  1.641081  2.79178268  0.009
## Block:FungusPen           0.6948000  1.594835  0.05782493  0.415
## Block:FungusPod           1.0500000  2.609495  0.03176724  0.401
## Block:FungusPre           0.1543500  1.713732 -0.98513696  0.855
## Block:FungusXyl           0.7074000  2.734658 -0.38407267  0.556
## Block:AgeYoung            1.3986000  1.565950  1.55086533  0.081
## FungusCer:AgeYoung        0.5794667  3.367753 -0.74130802  0.746
## FungusCok:AgeYoung        1.5839333  3.410924  0.20011719  0.354
## FungusCtrl:AgeYoung       2.3970000  5.642273  0.07070170  0.394
## FungusNig:AgeYoung        4.0526667  5.726562  1.03328104  0.166
## FungusPen:AgeYoung        1.3145333  5.410354 -0.56281946  0.647
## FungusPod:AgeYoung        1.4089667  6.736242 -0.65953491  0.704
## FungusPre:AgeYoung        3.6231833  5.582544  0.81975980  0.205
## FungusXyl:AgeYoung        4.2304333  6.870825  0.71704352  0.197
## Block:FungusCtrl:AgeYoung 0.1023000  2.455576 -1.22318440  0.939
## Block:FungusNig:AgeYoung  3.1697000  2.543829  2.68840384  0.014
## Block:FungusPen:AgeYoung  0.5183000  2.468054 -0.69008022  0.701
## Block:FungusPod:AgeYoung  2.2897000  3.856709  0.65193013  0.221
## Block:FungusPre:AgeYoung  1.8753500  2.470363  1.15902044  0.131
## Block:FungusXyl:AgeYoung  2.4271000  3.971562  0.69529753  0.221
lowLM <- lm.rrpp(Total ~ Block*Fungus*Age, data=low, SS.type="III", print.progress=F) ; summary(lowLM)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 314.3371    57.59527 0.8451458 1.984614
##                      Z (from F) Pr(>F)
## Block * Fungus * Age   1.404311   0.09
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##              Trace Proportion Rank
## Fitted    6.985269  0.8451459    1
## Residuals 1.279895  0.1548542    1
## Total     8.265164  1.0000000    1
## 
## Eigenvalues
## 
##                PC1
## Fitted    6.985269
## Residuals 1.279895
## Total     8.265164
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)           Zd Pr(>d)
## (Intercept)               14.046500 13.965178  1.598502712  0.045
## Block                      3.426250  1.984917  4.119848819  0.001
## FungusCer                  6.577567  5.511842  2.719404246  0.017
## FungusCok                  1.492200  6.902350 -0.552599128  0.640
## FungusCtrl                 1.270733  5.781253 -0.499083591  0.601
## FungusNig                  2.480000  5.710512  0.127061132  0.377
## FungusPen                  3.122967  5.753718  0.477962269  0.270
## FungusPod                  4.613567  5.726922  1.352948507  0.115
## FungusPre                  5.691400  5.417928  2.107465113  0.036
## FungusXyl                  2.848150  3.540888  1.375778288  0.110
## AgeYoung                   5.608600  5.420489  2.086786232  0.044
## Block:FungusCer            2.231300  2.310645  1.812591958  0.066
## Block:FungusCok            0.322250  3.716870 -0.947388077  0.844
## Block:FungusCtrl           0.010650  2.423836 -1.238000970  0.991
## Block:FungusNig            0.964250  2.379073 -0.004997778  0.417
## Block:FungusPen            0.351150  2.509073 -0.833822189  0.765
## Block:FungusPod            0.971500  2.415302 -0.001782977  0.428
## Block:FungusPre            0.982450  2.343578  0.088170677  0.394
## Block:AgeYoung             4.185050  2.642521  3.748898429  0.003
## FungusCer:AgeYoung         6.105833  7.714816  1.267998376  0.123
## FungusCok:AgeYoung         4.642800  9.503512  0.253820819  0.353
## FungusCtrl:AgeYoung        3.677733  7.795574  0.247276859  0.319
## FungusNig:AgeYoung         4.948250  7.609501  0.764640533  0.204
## FungusPen:AgeYoung         8.437000  7.892359  2.201506176  0.040
## FungusPod:AgeYoung         4.244600  7.824488  0.512062670  0.267
## FungusPre:AgeYoung        10.636200  7.769286  3.127722259  0.011
## FungusXyl:AgeYoung         3.552350  4.693658  1.159082705  0.131
## Block:FungusCer:AgeYoung   3.861000  3.700948  2.117453293  0.040
## Block:FungusCok:AgeYoung   2.405350  5.646958  0.053699113  0.412
## Block:FungusCtrl:AgeYoung  2.843800  3.702787  1.184145831  0.135
## Block:FungusNig:AgeYoung   2.810900  3.493581  1.226205299  0.124
## Block:FungusPen:AgeYoung   4.568300  3.804095  2.649358373  0.017
## Block:FungusPod:AgeYoung   2.859250  3.766930  1.227770762  0.131
## Block:FungusPre:AgeYoung   5.663050  3.580884  3.674304102  0.006
# ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(highANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df      SS     MS      Rsq      F        Z Pr(>F)  
## Block             1   0.221 0.2214 0.000905 0.0786           0.712  
## Fungus            8  24.327 3.0408 0.099495 3.3018  0.87448  0.188  
## Age               1   4.244 4.2436 0.017356 3.1404           0.094 .
## Block:Fungus      6   5.526 0.9210 0.022600 0.3270 -1.13474  0.869  
## Block:Age         1   1.956 1.9561 0.008000 1.4475           0.206  
## Fungus:Age        8   8.799 1.0999 0.035989 0.8140 -0.49572  0.703  
## Block:Fungus:Age  6   8.108 1.3513 0.033161 0.4797 -0.81835  0.811  
## Residuals         8  22.534 2.8167 0.092162                         
## Total            39 244.500                                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Total ~ Block * Fungus * Age, SS.type = "III", data = high,  
##     print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", "Block:Fungus:Age", "Residuals")) ; summary(lowANOVA)
## Warning in log(Z): NaNs produced
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)  
## Block             1  23.48 23.4784 0.063125 4.8917           0.068 .
## Fungus            8  15.97  1.9959 0.042930 1.7917  0.91703  0.153  
## Age               1   6.74  6.7407 0.018123 2.4616  0.97890  0.122  
## Block:Fungus      7   7.80  1.1140 0.020966 0.2321 -1.60813  0.939  
## Block:Age         1  17.51 17.5146 0.047091 6.3962           0.014 *
## Fungus:Age        8  15.32  1.9152 0.041195 0.6994 -0.72922  0.784  
## Block:Fungus:Age  7  19.17  2.7383 0.051536 0.5705 -0.62258  0.744  
## Residuals        12  57.60  4.7996 0.154854                         
## Total            45 371.93                                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Total ~ Block * Fungus * Age, SS.type = "III", data = low,  
##     print.progress = F)
# pairwise
highpw <- pairwise(highLM, groups = high$Fungus) ; summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                    d UCL (95%)             Z Pr > d
## Asp:Cer  2.594433333  3.812039 -3.954665e-02  0.533
## Asp:Cok  5.579033333  6.757072 -1.367275e-02  0.524
## Asp:Ctrl 2.044500000  2.865631  3.875306e-03  0.505
## Asp:Nig  2.109066667  2.953394 -1.940906e-02  0.525
## Asp:Pen  0.655633333  1.518069 -1.647441e-01  0.525
## Asp:Pod  4.098058333  5.001203  2.778474e-03  0.511
## Asp:Pre  2.106208333  3.012280 -2.436674e-02  0.529
## Asp:Xyl  1.025908333  1.915073 -2.668556e-02  0.503
## Cer:Cok  2.984600000  4.323065  2.153141e-02  0.515
## Cer:Ctrl 0.549933333  1.727749 -4.089082e-01  0.603
## Cer:Nig  0.485366667  1.636969 -4.659161e-01  0.612
## Cer:Pen  1.938800000  3.154183  5.623168e-03  0.499
## Cer:Pod  1.503625000  2.742521  1.824930e-02  0.480
## Cer:Pre  0.488225000  1.740016 -4.744391e-01  0.614
## Cer:Xyl  1.568525000  2.907379 -5.774385e-02  0.500
## Cok:Ctrl 3.534533333  4.676755 -1.659699e-02  0.508
## Cok:Nig  3.469966667  4.651340  2.638330e-06  0.518
## Cok:Pen  4.923400000  5.998903  3.570479e-02  0.513
## Cok:Pod  1.480975000  2.759216 -3.243378e-02  0.516
## Cok:Pre  3.472825000  4.669348  5.027707e-03  0.508
## Cok:Xyl  4.553125000  5.809938 -2.061802e-02  0.513
## Ctrl:Nig 0.064566667  1.040871 -1.170930e+00  0.913
## Ctrl:Pen 1.388866667  2.212370  7.117354e-02  0.461
## Ctrl:Pod 2.053558333  2.917332 -6.862494e-04  0.526
## Ctrl:Pre 0.061708333  1.103822 -1.193488e+00  0.920
## Ctrl:Xyl 1.018591667  1.991286 -2.842164e-02  0.492
## Nig:Pen  1.453433333  2.231779  5.055845e-02  0.482
## Nig:Pod  1.988991667  2.943447  1.983241e-02  0.496
## Nig:Pre  0.002858333  1.136061 -1.308734e+00  0.998
## Nig:Xyl  1.083158333  2.101251 -5.034647e-02  0.510
## Pen:Pod  3.442425000  4.356699  6.420656e-02  0.471
## Pen:Pre  1.450575000  2.304164  3.488796e-02  0.491
## Pen:Xyl  0.370275000  1.253998 -4.289162e-01  0.601
## Pod:Pre  1.991850000  3.006670  2.368274e-02  0.488
## Pod:Xyl  3.072150000  4.135326 -6.425890e-03  0.482
## Pre:Xyl  1.080300000  2.137962 -6.751978e-02  0.497
highpw2 <- pairwise(highLM, groups = high$Age) ; summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)           Z Pr > d
## Old:Young 3.012115  3.472667 -0.02145217  0.512
lowpw <- pairwise(lowLM, groups = low$Fungus) ; summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)            Z Pr > d
## Asp:Cer  2.9230500  4.191613  0.021014198  0.501
## Asp:Cok  0.7913250  2.275334 -0.218102220  0.501
## Asp:Ctrl 2.2543667  3.451344  0.053541805  0.473
## Asp:Nig  0.8882750  2.421483 -0.155071014  0.482
## Asp:Pen  2.7704667  3.989263  0.048371138  0.479
## Asp:Pod  3.4075167  4.581617  0.051997772  0.491
## Asp:Pre  4.0714500  5.330438  0.036290539  0.471
## Asp:Xyl  0.2617500  2.222896 -0.914283250  0.806
## Cer:Cok  2.1317250  3.437677  0.000642411  0.508
## Cer:Ctrl 0.6686833  1.864353 -0.310715671  0.571
## Cer:Nig  2.0347750  3.382907  0.011476309  0.496
## Cer:Pen  0.1525833  1.411810 -1.043842561  0.851
## Cer:Pod  0.4844667  1.657651 -0.402741842  0.586
## Cer:Pre  1.1484000  2.402595 -0.034185797  0.481
## Cer:Xyl  3.1848000  4.758612  0.034303087  0.507
## Cok:Ctrl 1.4630417  2.755800  0.001137154  0.490
## Cok:Nig  0.0969500  1.792232 -1.141932269  0.918
## Cok:Pen  1.9791417  3.298245  0.022819396  0.495
## Cok:Pod  2.6161917  4.017258  0.034244268  0.489
## Cok:Pre  3.2801250  4.669605  0.018793900  0.484
## Cok:Xyl  1.0530750  2.971412 -0.259364195  0.538
## Ctrl:Nig 1.3660917  2.664379 -0.021987340  0.479
## Ctrl:Pen 0.5161000  1.737725 -0.421214597  0.596
## Ctrl:Pod 1.1531500  2.305679 -0.053278230  0.510
## Ctrl:Pre 1.8170833  3.024396 -0.023286737  0.506
## Ctrl:Xyl 2.5161167  4.166173  0.045079752  0.484
## Nig:Pen  1.8821917  3.166039  0.030281828  0.483
## Nig:Pod  2.5192417  3.813857  0.040294181  0.501
## Nig:Pre  3.1831750  4.456738  0.031100619  0.481
## Nig:Xyl  1.1500250  3.066943 -0.200683755  0.520
## Pen:Pod  0.6370500  1.935758 -0.279985065  0.539
## Pen:Pre  1.3009833  2.552229 -0.047965977  0.512
## Pen:Xyl  3.0322167  4.664688  0.048599721  0.492
## Pod:Pre  0.6639333  1.994558 -0.259396330  0.526
## Pod:Xyl  3.6692667  5.352557  0.056020427  0.503
## Pre:Xyl  4.3332000  6.034100  0.045998381  0.490
lowpw2 <- pairwise(lowLM, groups = low$Age) ; summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)          Z Pr > d
## Old:Young 1.736996  2.386233 0.02114367  0.496
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, low$Fungus))